package cn.codeforfun.client;

import cn.codeforfun.generator.mapper.ClientMapper;
import org.springframework.security.oauth2.provider.ClientDetails;
import org.springframework.security.oauth2.provider.ClientDetailsService;
import org.springframework.security.oauth2.provider.ClientRegistrationException;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

/**
 * @author wangbin
 */
@Service
public class ClientService implements ClientDetailsService {
    @Resource
    private ClientMapper clientMapper;

    @Override
    public ClientDetails loadClientByClientId(String clientId) throws ClientRegistrationException {
        return ClientVO.fromClient(clientMapper.selectByPrimaryKey(clientId));
    }
}
